import axios from 'axios'


const instance = axios.create({
    baseURL:"/",
    timeout:10000,
    headers:{
        'Accept':"application/json",
        'Content-Type':"application/x-www-from-urlencoded"
    }
})

function resquestInter(config) {
    console.log(config);
    return config;
}

function responceInster(res) {
    console.log(res);
    return res;
}
instance.interceptors.resquestInter.use(resquestInter);

instance.interceptors.responceInster.use(responceInster);

function get (url ,params){
    return instance.get(url,{params});
}

function post(url,params) {
    let from = new FormData();
    for(let i in params){
        from.append(i,params[i])
    }
    return instance.post(url,from);
}
export{
    get,post
}